<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var dn = new Object();
        dn.name = '华为';
        dn.age = 324;
        dn.kg = '40kg';
        dn.fun = function () {
            console.log('可以打游戏，可以看电影');
        }
        console.log(dn.name,
            dn.age,
            dn.kg,
        );
        dn.fun();
        // for(var k in dn){
        //     console.log(dn[k]);
        // }


        var cat = {
            kg: '24kg',
            color: '红色',
            fun: function () {
                console.log('可以载人可以拉货');
            }
        }
        console.log(cat['kg'], cat['color']);
        cat.fun();


        function An(whith, hight, bcolor) {
            this.whith = whith;
            this.hight = hight;
            this.bcolor = bcolor;
            this.fun = function () {
                console.log('按下');
            }
        }
        var ann = new An(24, 34, '红色');
        console.log(ann.whith, ann.hight, ann.bcolor);
        ann.fun();




        // 函数作业
        function revose(arr) {
            var as = [];
            for (let i = arr.length - 1; i >= 0; i--) {
                as[as.length] = arr[i]
            }
            return as;
        }
        var fz = revose([1, 2, 3, 4, 5, 6]);
        console.log(fz);


        function mp(arrs) {
            for (let i = 0; i < arrs.length; i++) {
                for (let j = 0; j < arrs.length - i - 1; j++) {
                    if (arrs[j] > arrs[j + 1]) {
                        let mpa = arrs[j];
                        arrs[j] = arrs[j + 1];
                        arrs[j + 1] = mpa;
                    }
                }
            }
            return arrs;
        }
        var mps=mp([10,2,9,3,8,4,7,5,6,1])
        console.log(mps);
    </script>
</body>

</html>